#ifndef SC_XML_H_INCLUDED
#define SC_XML_H_INCLUDED

#include <wx/wxprec.h>

#ifdef __BORLANDC__
    #pragma hdrstop
#endif

#ifndef WX_PRECOMP
    #include <wx/wx.h>
#endif

#include <libxml/parser.h>

#include <libxslt/xslt.h>
#include <libxslt/xsltInternals.h>
#include <libxslt/transform.h>
#include <libxslt/xsltutils.h>

#include <string>

namespace xml {
	
// Relax NG : Gramar file
#if 0
struct rng
{
	// Namespace
	static const xmlChar* NS;
	static const xmlChar* NS_VALUE;

	// RNG Element
	static const xmlChar* _element;
	static const xmlChar* _ref;
	static const xmlChar* _zeroOrMore;
	static const xmlChar* _optional;

	static const xmlChar* _text;
	static const xmlChar* _attribute;
	static const xmlChar* _data;
	static const xmlChar* _choice;
	static const xmlChar* _value;

	static const xmlChar* _param;

	// RNG Attributes
	static const xmlChar* _name;

	static const xmlChar* _type;

	static const xmlChar* _int;
	static const xmlChar* _integer;
	static const xmlChar* _float;
	static const xmlChar* _string;

	static const xmlChar* _minInclusive;
	static const xmlChar* _maxInclusive;
	static const xmlChar* _minExclusive;
	static const xmlChar* _maxExclusive;
	static const xmlChar* _pattern;
};
#endif // 0


// Context file
struct scc
{
	// SCC Element
	static const xmlChar* _context;
	static const xmlChar* _file;
	static const xmlChar* _xslt;
	static const xmlChar* _mmi;
	static const xmlChar* _element_label;
	static const xmlChar* _attribute_label;

	// SCC Attributes
	static const xmlChar* _title;
	static const xmlChar* _setup;
	static const xmlChar* _rng;
	static const xmlChar* _xsl;
	static const xmlChar* _xsltres;
	static const xmlChar* _path;
	static const xmlChar* _for;
	static const xmlChar* _value;
	static const xmlChar* _default;
	static const xmlChar* _icon;
	static const xmlChar* _error;
	static const xmlChar* _help;
	static const xmlChar* _type;
	static const xmlChar* _type_directory;
	static const xmlChar* _type_file;
};

inline
wxString ToWx(const xmlChar* buffer, wxMBConv& conv = wxConvUTF8)
{
	return wxString((const char*)buffer, conv);
}

bool XslTransform(const wxString& sXmlFile, const wxString& sXslFile, const wxString& sXslResFile);

bool RngValidate(const wxString& sXmlFile, const wxString& sRngFile);

bool RngValidate(const xmlDocPtr xmlDoc, const xmlNodePtr xmlElement, const wxString& sRngFile);

}; // namespace xml

#endif // SC_XML_H_INCLUDED
